<?php
class LoginForm extends sfForm
{
 /**
  * Configures Login form
  */
  public function configure()
  {
    $this->setWidgets(array(
      'username' => new sfWidgetFormInput(),
      'password' => new sfWidgetFormInputPassword(),
    ));
    
    $this->setValidators(array(
      'password'   => new sfValidatorString(array('max_length' => 50, 'trim' => true)),
      'username' => new sfValidatorString(array('max_length' => 50, 'trim' => true)),
    ));
    
    $this->validatorSchema->setPostValidator(new myValidatorLogin());
    
    $this->widgetSchema->setNameFormat('login[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
    
    $decorator = new myWidgetFormSchemaFormatterDl($this->widgetSchema);
    $this->widgetSchema->addFormFormatter('dl', $decorator); 
    $this->widgetSchema->setFormFormatterName('dl');   
  }
}